package a10_动态规划;

//112和121当作不同的两个结果，所以此题求的是排列
public class a21_组合总和4 {
    public int combinationSum4(int[] nums, int target) {
        int[] dp = new int[target+1];
        dp[0]=1;
        for (int j = 0; j <= target; j++) {
            for (int i = 0; i < nums.length; i++) {
                if(j >= nums[i]){
                    dp[j] = dp[j] + dp[j-nums[i]];
                }

            }
        }
        return dp[target];
    }
}
